﻿CREATE proc [dbo].[proc_CheckInOut_GetItem]
(
	@id int,
	@UserName nvarchar(50)
)
as
	select 
		id,
		CompanyId,
		CustomerId,
		(select CustomerName from Customer where Customer.CustomerId=CheckInOut.CustomerId) as Customer,
		ContactPerson,
		ContactTel, 
		Address,
		MainProjectId,
		(Select Title From OProject Where Id=CheckInOut.MainProjectId) As MainProject,
		Content,
		Aim,
		Accompany,
		UserName,
		IsNull(CheckInTime,'') As CheckInTime,
		CheckOutTime 
		from  CheckInOut where id=@id and UserName=@UserName